<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="../css/beiyong.css"/>
		<style type="text/css">
			body{
				width: 100%;
			}
			img{
				width: 100%;
			}
		</style>
	</head>
	<body>
		
		<img id="imgid" src="../images/101.jpg"/>
		<button type="button" id="upimg" class="mui-btn mui-btn-blue mui-btn-block">点击上传</button>
		<script src="../js/mui.min.js"></script>  
        <script src="../js/jquery.min.js"></script>  
		<script src="../js/req.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/muishow.js" type="text/javascript" charset="utf-8"></script>
		
		<script type="text/javascript">
			window.onload = function(){
				console.log(isOdd(10))
				console.log(isOdd(11))
				console.log(isOdd2(10))
				console.log(isOdd2(11))
				console.log(isOdd3(10))
				console.log(isOdd3(11))
				console.log(isOdd4(10))
				console.log(isOdd4(11))
				console.log(isOdd1(10))
				console.log(isOdd1(11))
			}
			
			function isOdd(num){
				return num % 2 != 0;
			}
			function isOdd1(num){
				return (num/2*2)==num;
			}
			function isOdd2(num){
				return num >> 1 << 1 != num;
			}
			function isOdd3(num){
				return (num & 1) == 1;
			}
			function isOdd4(num){
				return ~num + num;
			}
			
			
			g("upimg").addEventListener("tap",function(e){
				let img = new Image();
				img.src = g("imgid").src;
				img.onload = function() {
					var canvas = document.createElement("canvas");
					let imgw = img.width;
					let imgh = img.height;
					canvas.width = imgw;
					canvas.height = imgh;
					var ctx = canvas.getContext("2d");
					ctx.drawImage(img, 0, 0, imgw, imgh);
					var ext = img.src.substring(img.src.lastIndexOf(".") + 1).toLowerCase();
					var dataURL = canvas.toDataURL("image/" + ext);
					var data = {
                		url:'/api/Image/uploadBase64',
                		data:{
                			access_token:acctoken(),
                			base64:dataURL
                		}
                	}
					
					ajax(data,function(res){
						
						console.log(res);
					})
				}
				
				
			})
			
			
			
		</script>
	</body>
</html>
